<template>
  <div class="app-container">
    <el-tabs v-model="activeName" @tab-click="dianji">
      <el-tab-pane label="从电脑上传人脸数据到设备" name="first" >
        <el-row :gutter="20">
          <!--部门数据-->
          <el-col :span="6" :xs="24">
            <div class="head-container">
              <el-input
                v-model="deptName"
                placeholder="请输入部门名称"
                clearable
                size="small"
                prefix-icon="el-icon-search"
                style="margin-bottom: 20px"
              />
            </div>
            <div class="head-container">
              <el-table
                ref="multipleTable"
                :data="devicepersonLists"
                tooltip-effect="dark"
                highlight-current-row
                style="width: 100%;border: 1px solid lightgrey"
                @cell-click="handleSelectionChanges">
                <el-table-column  width="55"></el-table-column>
                <el-table-column prop="compamyDept" label="部门名称"></el-table-column>
              </el-table>
<!--              <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="100px"-->
<!--                       label-position="top" style="float: left">-->
<!--                <el-form-item label="权限下发" prop="field101">-->
<!--                  <el-checkbox-group v-model="formData.field101" size="medium">-->
<!--                    <el-checkbox v-for="(item, index) in field101Options" :key="index" :label="item.value"-->
<!--                                 :disabled="item.disabled">{{item.label}}</el-checkbox>-->
<!--                  </el-checkbox-group>-->
<!--                </el-form-item>-->
<!--              </el-form>-->
              <div>
                <span><h4>权限下发</h4></span>
                <el-checkbox v-model="faceswiping">刷脸</el-checkbox>
                <el-checkbox v-model="swipingcard ">刷卡</el-checkbox>
                <el-checkbox v-model="personka">卡+人脸</el-checkbox>
                <el-tooltip class="item" effect="dark" content="不支持海思设备" placement="top">
                  <el-checkbox v-model="Witness">人证比对</el-checkbox>
                </el-tooltip>

              </div>
            </div>
          </el-col>
          <!--用户数据-->
          <el-col :span="12" :xs="24">
            <el-row :gutter="10" class="mb8" style="float: right;margin-top:5px">
              <el-col :span="1.5">
                <el-button
                  type="info"
                  icon="el-icon-upload2"
                  size="mini"
                  @click="handleImport"
                  v-hasPermi="['system:user:import']"
                >人员下发</el-button>
              </el-col>
              <el-col :span="1.5">
                <el-button
                  type="warning"
                  icon="el-icon-download"
                  size="mini"
                  @click="personxia"
                  v-hasPermi="['system:user:export']"
                >人员照片下发</el-button>
              </el-col>
            </el-row>
            <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px" style="float: left;">
              <el-form-item label="用户名称" prop="userName">
                <el-input
                  v-model="queryParams.jobName"
                  placeholder="请输入用户名称"
                  clearable
                  size="small"
                  style="width: 240px"
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item>
                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
              </el-form-item>
            </el-form>

            <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange" style="border: 1px solid lightgrey">
              <el-table-column type="selection" width="40" align="center" />
              <el-table-column label="用户编号" align="center" prop="jobNum" />
              <el-table-column label="卡号" align="center" prop="cardNo" :show-overflow-tooltip="true" />
              <el-table-column label="用户昵称" align="center" prop="jobName" :show-overflow-tooltip="true" />
              <el-table-column label="授权照片" align="center" :show-overflow-tooltip="true">
                <template slot-scope="scope">
                  <img :src="scope.row.phototFirst" style="width: 60px;height: 60px">
                </template>
              </el-table-column>
            </el-table>
<!--            <pagination-->
<!--              v-show="total>0"-->
<!--              :total="total"-->
<!--              :page.sync="queryParams.pageNum"-->
<!--              :limit.sync="queryParams.pageSize"-->
<!--              @size-change="handleSizeChange"-->
<!--              @pagination="getinfo"-->
<!--            />-->
<!--            <el-pagination-->
<!--              v-show="total>0"-->
<!--              :total="total"-->
<!--              @size-change="handleSizeChange"-->
<!--              @current-change="handleCurrentChange"-->
<!--              :page-sizes="[10, 20, 50, 100]"-->
<!--              @pagination="getinfo"-->
<!--              layout="total, sizes, prev, pager, next, jumper"-->
<!--              >-->
<!--            </el-pagination>-->
            <!-- 分页功能 -->
            <el-pagination
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
              :current-page="queryParams.pageNum"
              :page-sizes="[10, 20, 30, 50]"
              style="float: right;margin-top: 10px"
              :page-size="queryParams.pageSize"
              layout="total, sizes, prev, pager, next, jumper"
              :total="total"
            ></el-pagination>
          </el-col>
          <el-col :span="6" :xs="10">
            <div>
            <el-table
              ref="multipleTable"
              :data="iplist"
              height="350"
              tooltip-effect="dark"
              style="width: 100%;border: 1px solid lightgrey"
              @selection-change="selectIp">
              <el-table-column type="selection" width="50"></el-table-column>
              <el-table-column prop="deviceIp" label="设备Ip" width="140"></el-table-column>
              <el-table-column prop="deviceName" label="设备名称" width="110"></el-table-column>
              <el-table-column prop="deviceLocation" label="进出方向"></el-table-column>
            </el-table>
           <div>
             <span><h3>信息提示</h3></span>
             <ul class="infinite-list"  style="overflow:auto">
               <li v-for="i in jihe" class="infinite-list-item">{{i}}</li>
             </ul>
           </div>
            </div>
          </el-col>
        </el-row>
      </el-tab-pane>
      <el-tab-pane label="从设备删除人脸数据" name="second">
        <el-row :gutter="20">
          <!--部门数据-->
          <el-col :span="6" :xs="24">
            <div class="head-container">
              <el-input
                v-model="deptName"
                placeholder="请输入部门名称"
                clearable
                size="small"
                prefix-icon="el-icon-search"
                style="margin-bottom: 20px"
              />
            </div>
            <div class="head-container">
              <el-table
                ref="multipleTable"
                :data="devicepersonLists"
                tooltip-effect="dark"
                highlight-current-row
                style="width: 100%;border: 1px solid lightgrey"
                @cell-click="handleSelectionChanges">
                <el-table-column  width="55"></el-table-column>
                <el-table-column prop="compamyDept" label="部门名称"></el-table-column>
              </el-table>
            </div>
          </el-col>
          <!--用户数据-->
          <el-col :span="12" :xs="24">
            <el-row :gutter="10" class="mb8" style="float: right;margin-top:5px">
              <el-col :span="1.5">
                <el-button
                  type="info"
                  icon="el-icon-delete"
                  size="mini"
                  @click="handleImportxia"
                  v-hasPermi="['system:user:import']"
                >人员删除</el-button>
              </el-col>
              <el-col :span="1.5">
                <el-button
                  type="danger"
                  icon="el-icon-delete-solid"
                  size="mini"
                  @click="handleExportimg"
                  v-hasPermi="['system:user:export']"
                >删除人员照片</el-button>
              </el-col>
            </el-row>
            <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px" style="float: left;">
              <el-form-item label="用户名称" prop="userName">
                <el-input
                  v-model="queryParams.jobName"
                  placeholder="请输入用户名称"
                  clearable
                  size="small"
                  style="width: 240px"
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item>
                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
              </el-form-item>
            </el-form>

            <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange" style="border: 1px solid lightgrey">
              <el-table-column type="selection" width="40" align="center" />
              <el-table-column label="用户编号" align="center" prop="jobNum" />
              <el-table-column label="卡号" align="center" prop="cardNo" :show-overflow-tooltip="true" />
              <el-table-column label="用户昵称" align="center" prop="jobName" :show-overflow-tooltip="true" />
              <el-table-column label="授权照片" align="center" :show-overflow-tooltip="true">
                <template slot-scope="scope">
                  <img :src="scope.row.phototFirst" style="width: 60px;height: 60px">
                </template>
              </el-table-column>
            </el-table>
            <!--            <pagination-->
            <!--              v-show="total>0"-->
            <!--              :total="total"-->
            <!--              :page.sync="queryParams.pageNum"-->
            <!--              :limit.sync="queryParams.pageSize"-->
            <!--              @size-change="handleSizeChange"-->
            <!--              @pagination="getinfo"-->
            <!--            />-->
            <!--            <el-pagination-->
            <!--              v-show="total>0"-->
            <!--              :total="total"-->
            <!--              @size-change="handleSizeChange"-->
            <!--              @current-change="handleCurrentChange"-->
            <!--              :page-sizes="[10, 20, 50, 100]"-->
            <!--              @pagination="getinfo"-->
            <!--              layout="total, sizes, prev, pager, next, jumper"-->
            <!--              >-->
            <!--            </el-pagination>-->
            <!-- 分页功能 -->
            <el-pagination
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
              :current-page="queryParams.pageNum"
              :page-sizes="[10, 20, 30, 50]"
              style="float: right;margin-top: 10px"
              :page-size="queryParams.pageSize"
              layout="total, sizes, prev, pager, next, jumper"
              :total="total"
            ></el-pagination>
          </el-col>
          <el-col :span="6" :xs="10">
            <el-table
              ref="multipleTable"
              :data="iplist"
              height="350"
              tooltip-effect="dark"
              style="width: 100%;border: 1px solid lightgrey"
              @selection-change="selectIp">
              <el-table-column type="selection" width="50"></el-table-column>
              <el-table-column prop="deviceIp" label="设备Ip" width="140"></el-table-column>
              <el-table-column prop="deviceName" label="设备名称" width="110"></el-table-column>
              <el-table-column prop="deviceLocation" label="进出方向"></el-table-column>
            </el-table>
            <div>
              <span><h3>信息提示</h3></span>
              <ul class="infinite-list"  style="overflow:auto">
                <li v-for="i in jihe" class="infinite-list-item">{{i}}</li>
              </ul>
            </div>
          </el-col>

        </el-row>
      </el-tab-pane>
    </el-tabs>


  </div>
</template>

<script>
  import { listCompanydeviceinfo} from "@/api/lgdz/companydeviceinfo";
  import { listCompanydept} from "@/api/lgdz/companydept";
  import { getToken } from "@/utils/auth";
  import {listPerson} from "@/api/lgdz/person"
  import { treeselect } from "@/api/system/dept";
  import Treeselect from "@riophae/vue-treeselect";
  import "@riophae/vue-treeselect/dist/vue-treeselect.css";

  export default {
    name: "User",
    components: { Treeselect },
    data() {
      return {

        // 刷脸
        faceswiping: true,
        // 刷卡
        swipingcard:true,
        // 卡+人脸
        personka:true,
        // 人证比对
        Witness:true,
        count: 0,

        formData: {
          field101: ["刷脸","刷卡","卡+人脸","人证比对"],
        },
        // 人员删除
        pers:"",
        iplist:[],
        field101Options: [{
          "label": "刷脸",
          "value": "刷脸"
        }, {
          "label": "刷卡",
          "value": "刷卡"
        }, {
          "label": "卡+人脸",
          "value": "卡+人脸"
        }, {
          "label": "人证比对",
          "value": "人证比对"
        }],
        // 遮罩层
        loading: true,
        // 选中数组
        ids: [],
        // 部门
        dept:"",
        zt:"",
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        activeName:"first",
        // 总条数
        total: 0,
        // 用户表格数据
        userList: null,
        ipes:"",
        devicepersonLists:[],
        // 弹出层标题
        title: "",
        // 部门树选项
        deptOptions: undefined,
        // 是否显示弹出层
        open: false,
        // 部门名称
        deptName: undefined,
        // 默认密码
        initPassword: undefined,
        // 日期范围
        dateRange: [],
        // 状态数据字典
        statusOptions: [],
        jihe:[],
        // 性别状态字典
        sexOptions: [],
        // 岗位选项
        postOptions: [],
        // 设备位置字典
        deviceLocationOptions: [],
        // 角色选项
        roleOptions: [],
        // 表单参数
        form: {},
        defaultProps: {
          children: "children",
          label: "label"
        },
        // 用户导入参数
        upload: {
          // 是否显示弹出层（用户导入）
          open: false,
          // 弹出层标题（用户导入）
          title: "",
          // 是否禁用上传
          isUploading: false,
          // 是否更新已经存在的用户数据
          updateSupport: 0,
          // 设置上传的请求头部
          headers: { Authorization: "Bearer " + getToken() },
          // 上传的地址
          url: process.env.VUE_APP_BASE_API + "/system/user/importData"
        },
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          jobName: undefined,
        },
        // 表单校验
        rules: {
          userName: [
            { required: true, message: "用户名称不能为空", trigger: "blur" }
          ],
          nickName: [
            { required: true, message: "用户昵称不能为空", trigger: "blur" }
          ],
          deptId: [
            { required: true, message: "归属部门不能为空", trigger: "blur" }
          ],
          password: [
            { required: true, message: "用户密码不能为空", trigger: "blur" }
          ],
          email: [
            { required: true, message: "邮箱地址不能为空", trigger: "blur" },
            {
              type: "email",
              message: "'请输入正确的邮箱地址",
              trigger: ["blur", "change"]
            }
          ],
          phonenumber: [
            { required: true, message: "手机号码不能为空", trigger: "blur" },
            {
              pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
              message: "请输入正确的手机号码",
              trigger: "blur"
            }
          ]
        }
      };
    },
    created() {
      this.getList();
      this.getListtwo()
      this.getDicts("sys_normal_disable").then(response => {
        this.statusOptions = response.data;
      });
      this.getDicts("sys_user_sex").then(response => {
        this.sexOptions = response.data;
      });
      this.getConfigKey("sys.user.initPassword").then(response => {
        this.initPassword = response.msg;
      });
      this.getDicts("CompanyDeviceInfoTable_DeviceDirection").then(response => {
        this.deviceLocationOptions = response.data;
      });
    },
    methods: {
      dianji(val){
        // console.log(val)
        if(val.name=="second"){
          this.userList=[]
        }
      },
      // load () {
      //   this.count =50
      // },
      // 设备位置字典翻译
      deviceLocationFormat(row, column) {
        return this.selectDictLabel(this.deviceLocationOptions, row.deviceLocation);
      },
      handleSizeChange(val){
        // console.log(`每页 ${val} 条`);
        this.queryParams.pageSize=val
        this.getinfo()
      },
      handleCurrentChange(val) {
        this.queryParams.pageNum=val
        this.getinfo()
      },
      // 人员照片下发
      personxia(){
        for (var c = 0; c < this.ipes.length; c++) {
          for (var i = 0; i < this.ids.length; i++) {
            const api = "http://192.168.10.175:8088/device/shouquanFace";
            let multipleSelections = JSON.stringify(this.multipleSelection);
            // let datas = JSON.stringify(this.data);
            this.$axios({
              url: api,
              method: "post",
              data: {
                personids: this.ids[i],
                deviceids: this.ipes[c],
              },
              // timeout: 3000, //设置超时，单位毫秒
            })
              .then((res) => {
                // console.log(res)
                this.pers = res.data.msg.substring(0,7);//截取第二个到第四个之间的字符 cd
                // console.log(str)
                if(res.data.success==false){
                  this.zt="失败"
                }
                if(res.data.success==true){
                  this.zt="成功"
                }
                this.jihe.push(res.data.JobName+" "+"数据下发到"+" "+res.data.deviceName+" "+ this.pers+" "+this.zt)
              })
          }
        }
      },
      /** 查询公司部门列表 */
      getList() {
        this.loading = true;
        listCompanydept(this.queryParams).then(response => {
          // console.log(response)
          this.devicepersonLists = response.rows;
          // this.total = response.total;
          this.loading = false;
        });
      },
      /** 查询设备ip信息列表 */
      getListtwo() {
        // listCompanydeviceinfo(this.queryParams).then(response => {
        //   // console.log(response)
        //   this.iplist = response.rows;
        //   // this.total = response.total;
        //
        // });
        const api = "http://192.168.10.175:8088/device/queryAllDevice";
        this.$axios({
          url: api,
          method: "post",
          //用于表示用户代理是否在跨域请求的情况下从其他域中发送cookies
          //  withCredentials:true,//默认为false
        }).then((res) => {
          // console.log(res);
            this.iplist=res.data.rows
          this.iplist.forEach((item)=>{
           if(item.deviceLocation==1){
             item.deviceLocation="进口"
           }
            if(item.deviceLocation==2){
              item.deviceLocation="出口"
            }
          })
        })

      },
      selectIp(row){
      // console.log(row)
       this.ipes= row.map(item => item.id);
        // this.ides = selection.map((item) => item.id);
      },
      /** 部门点击 */
      handleSelectionChanges(row) {
        // console.log(row);
        this.dept=row.id
        this.getinfo()
        // this.ides = selection.map((item) => item.id);
        // console.log(this.ides);
        // this.single = selection.length != 1;
        // this.multiple = !selection.length;
      },

      getinfo() {
        const api = "http://192.168.10.175:8088/device/queryDeptPerson";
        this.$axios({
          url: api,
          method: "get",
          //用于表示用户代理是否在跨域请求的情况下从其他域中发送cookies
          //  withCredentials:true,//默认为false
          params: {
            deptName: this.dept,
            pageNum: this.queryParams.pageNum,
            pageSize: this.queryParams.pageSize,
          },
        }).then((res) => {
          // console.log(res);
          this.userList=res.data.rows
          this.total = res.data.total;
        })

      },

      filterNode(value, data) {
        if (!value) return true;
        return data.label.indexOf(value) !== -1;
      },
      // 节点单击事件
      handleNodeClick(data) {
        this.queryParams.deptId = data.id;
        this.getList();
      },
      // 用户状态修改
      handleStatusChange(row) {
        let text = row.status === "0" ? "启用" : "停用";
        this.$confirm('确认要"' + text + '""' + row.userName + '"用户吗?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return changeUserStatus(row.userId, row.status);
        }).then(() => {
          this.msgSuccess(text + "成功");
        }).catch(function() {
          row.status = row.status === "0" ? "1" : "0";
        });
      },
      // 取消按钮
      cancel() {
        this.open = false;
        this.reset();
      },
      // 表单重置
      reset() {
        this.form = {
          userId: undefined,
          deptId: undefined,
          userName: undefined,
          nickName: undefined,
          password: undefined,
          phonenumber: undefined,
          email: undefined,
          sex: undefined,
          status: "0",
          remark: undefined,
          postIds: [],
          roleIds: []
        };
        this.resetForm("form");
      },
      /** 搜索按钮操作 */
      handleQuery() {
        // this.queryParams.pageNum = 1;
        // this.getinfo();
        const api = "http://192.168.10.175:8088/device/queryJobByJobName";
        this.$axios({
          url: api,
          method: "get",
          params: {
            jobName: this.queryParams.jobName,
            pageNum:this.queryParams.pageNum,
            pageSize:this.queryParams.pageSize
          },
        })
          .then((res) => {
            // console.log(res)
            this.userList=res.data.rows
            this.total = res.data.total;
          })
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.dateRange = [];
        this.resetForm("queryForm");
        this.handleQuery();
      },
      // 多选框选中数据
      handleSelectionChange(selection) {
        this.ids = selection.map(item => item.id);
        // console.log(this.ids)
        this.single = selection.length != 1;
        this.multiple = !selection.length;
      },
      /** 新增按钮操作 */
      handleAdd() {
        this.reset();
        this.getTreeselect();
        getUser().then(response => {
          this.postOptions = response.posts;
          this.roleOptions = response.roles;
          this.open = true;
          this.title = "添加用户";
          this.form.password = this.initPassword;
        });
      },
      /** 修改按钮操作 */
      handleUpdate(row) {
        this.reset();
        this.getTreeselect();
        const userId = row.userId || this.ids;
        getUser(userId).then(response => {
          this.form = response.data;
          this.postOptions = response.posts;
          this.roleOptions = response.roles;
          this.form.postIds = response.postIds;
          this.form.roleIds = response.roleIds;
          this.open = true;
          this.title = "修改用户";
          this.form.password = "";
        });
      },
      /** 重置密码按钮操作 */
      handleResetPwd(row) {
        this.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消"
        }).then(({ value }) => {
          resetUserPwd(row.userId, value).then(response => {
            if (response.code === 200) {
              this.msgSuccess("修改成功，新密码是：" + value);
            } else {
              this.msgError(response.msg);
            }
          });
        }).catch(() => {});
      },
      /** 提交按钮 */
      submitForm: function() {
        this.$refs["form"].validate(valid => {
          if (valid) {
            if (this.form.userId != undefined) {
              updateUser(this.form).then(response => {
                if (response.code === 200) {
                  this.msgSuccess("修改成功");
                  this.open = false;
                  this.getList();
                } else {
                  this.msgError(response.msg);
                }
              });
            } else {
              addUser(this.form).then(response => {
                if (response.code === 200) {
                  this.msgSuccess("新增成功");
                  this.open = false;

                  this.getList();
                } else {
                  this.msgError(response.msg);
                }
              });
            }
          }
        });
      },
      /** 删除按钮操作 */
      handleDelete(row) {
        const userIds = row.userId || this.ids;
        this.$confirm('是否确认删除用户编号为"' + userIds + '"的数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return delUser(userIds);
        }).then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        }).catch(function() {});
      },
      /** 导出按钮操作 */
      handleExport() {
        const queryParams = this.queryParams;
        this.$confirm('是否确认导出所有用户数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return exportUser(queryParams);
        }).then(response => {
          this.download(response.msg);
        }).catch(function() {});
      },
      /** 人员下发 */
      handleImport() {
        for (var c = 0; c < this.ipes.length; c++) {
          for (var i = 0; i < this.ids.length; i++) {
            const api = "http://192.168.10.175:8088/device/souquan";
            let multipleSelections = JSON.stringify(this.multipleSelection);
            // let datas = JSON.stringify(this.data);
            this.$axios({
              url: api,
              method: "post",
              data: {
                personids: this.ids[i],
                deviceids: this.ipes[c],
                facePermission:this.faceswiping,
                idCardPermission:this.swipingcard,
                faceAndCardPermission:this.personka,
                iDPermission:this.Witness
              },
              // timeout: 3000, //设置超时，单位毫秒
            })
              .then((res) => {
                // console.log(res)
                // console.log(res.data.JobName,res.data.msg,res.data.success)
               this.pers = res.data.msg.substring(0,7);//截取第二个到第四个之间的字符 cd
                // console.log(str)
                if(res.data.success==false){
                  this.zt="失败"
                }
                if(res.data.success==true){
                  this.zt="成功"
                }
                this.jihe.push(res.data.JobName+" "+"数据下发到"+" "+res.data.deviceName+" "+ this.pers+" "+this.zt)
              })

          }
        }
      },
      /** 设备删除人员 */
      handleImportxia() {
        for (var c = 0; c < this.ipes.length; c++) {
          for (var i = 0; i < this.ids.length; i++) {
            const api = "http://192.168.10.175:8088/device/xiaoquan";
            let multipleSelections = JSON.stringify(this.multipleSelection);
            // let datas = JSON.stringify(this.data);
            this.$axios({
              url: api,
              method: "post",
              data: {
                personids: this.ids[i],
                deviceids: this.ipes[c],
              },
              // timeout: 3000, //设置超时，单位毫秒
            })
              .then((res) => {
                // console.log(res)
                // let str = res.data.msg.substring(0,8);//截取第二个到第四个之间的字符 cd
                // console.log(str)
                if(res.data.success==false){
                  this.zt="失败"
                  this.$message({
                    message: '请检查设备是否在线',
                    type: 'warning'
                  });
                }

                if (res.data.data.effective==""){
                    this.pers="删除失败,人员id不存在"
                }
                if (res.data.data.effective!=""){
                  this.pers="删除成功"
                }
                this.jihe.push(res.data.JobName+" "+"删除数据下发到"+" "+res.data.deviceName+" "+ this.pers+" "+" ")
              })
          }
        }
      },
      // 人员照片删除
      handleExportimg() {
        for (var c = 0; c < this.ipes.length; c++) {
          for (var i = 0; i < this.ids.length; i++) {
            const api = "http://192.168.10.175:8088/device/xiaoquanFace";
            let multipleSelections = JSON.stringify(this.multipleSelection);
            // let datas = JSON.stringify(this.data);
            this.$axios({
              url: api,
              method: "post",
              data: {
                personids: this.ids[i],
                deviceids: this.ipes[c],
              },
              // timeout: 3000, //设置超时，单位毫秒
            })
              .then((res) => {
                // console.log(res)
                // let str = res.data.msg.substring(0,8);//截取第二个到第四个之间的字符 cd
                // console.log(str)
                if(res.data.success==false){
                  this.zt="失败"
                }

                this.jihe.push(res.data.JobName+" "+"删除数据下发到"+" "+res.data.deviceName+" "+ res.data.msg.substring(0,6)+" "+" "+this.zt)
              })
          }
        }
      },
      /** 下载模板操作 */
      importTemplate() {
        importTemplate().then(response => {
          this.download(response.msg);
        });
      },
      // 文件上传中处理
      handleFileUploadProgress(event, file, fileList) {
        this.upload.isUploading = true;
      },
      // 文件上传成功处理
      handleFileSuccess(response, file, fileList) {
        this.upload.open = false;
        this.upload.isUploading = false;
        this.$refs.upload.clearFiles();
        this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
        this.getList();
      },
      // 提交上传文件
      submitFileForm() {
        this.$refs.upload.submit();
      }
    }
  };
</script>
<style lang="less" scoped>
  .app-container{
    .pagination-container {
      height: 32px !important;
    }
    .infinite-list{
      height: 400px;
      /*background-color: #8c939d;*/
      border: 1px solid #8c939d;
    }
    .infinite-list-item{
      /*height: 15px;*/
      /*background-color: #4AB7BD;*/
      margin-top: 5px;
    }
    ul li{
      list-style: none;
    }
    ul{
      padding-inline-start: 10px !important;
    }
    /deep/.el-table__body tr.current-row>td{
      background-color: #c4e2ff;
    }
    /*/deep/ .el-table, .el-table__expanded-cell { background-color: transparent; }*/
    /*/deep/ .el-table tr { background-color: transparent !important; }*/
    /*/deep/ .el-table--enable-row-transition .el-table__body td, .el-table .cell { background-color: transparent; }*/
    /*/deep/ .el-table__row > td { border: none; }*/
    /*/deep/ .el-table thead { border: 0; }*/
    /*/deep/ .el-table {*/
    /*  border: 0;*/

    /*  th, tr, td {*/
    /*    border: 0;*/
    /*    background-color: #fff;*/
    /*  }*/

    /*  &::before {*/
    /*    height: 0px;*/
    /*  }*/

    /*  &::after {*/
    /*    width: 0;*/
    /*  }*/
    /*}*/
  }



</style>
